{layout name="layout"}
<style type="text/css">
    .file {
        position: relative;
        display: inline-block;
        overflow: hidden;
        text-decoration: none;
        text-indent: 0;
        text-align: center;
    }
    .file input {
        position: absolute;
        right: -13px;
        top: 0;
        opacity: 0;
    }
    .file:hover {
        text-decoration: none;
    }
</style>
<link href="__CSS__/admin.css" rel="stylesheet">
<link href="__PLU__/summernote/summernote.min.css" rel="stylesheet">
<script src="__PLU__/summernote/summernote.js"></script>
<script src="__PLU__/summernote/lang/summernote-zh-CN.js"></script>
<div class="row">
    <div class="col-lg-12">
        <div id="demo-theme" class="panel">
            <div class="panel-heading">
                <h3 class="panel-title">主题设置</h3>
            </div>
            <div class="panel-body bg-light pad-top">
                <div class="col-md-4 pad-ver">
                    <div class="demo-justify-theme">
                        <a href="#" class="demo-theme demo-a-light add-tooltip" data-theme="theme-light" data-type="a" data-title="(A). 浅色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                        <a href="#" class="demo-theme demo-a-navy add-tooltip" data-theme="theme-navy" data-type="a" data-title="(A). 藏青色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                        <a href="#" class="demo-theme demo-a-ocean add-tooltip" data-theme="theme-ocean" data-type="a" data-title="(A). 深蓝">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                    </div>
                    <div class="demo-justify-theme">
                        <a href="#" class="demo-theme demo-a-lime add-tooltip" data-theme="theme-lime" data-type="a" data-title="(A). 绿黄色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                        <a href="#" class="demo-theme demo-a-purple add-tooltip" data-theme="theme-purple" data-type="a" data-title="(A). 紫色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                        <a href="#" class="demo-theme demo-a-dust add-tooltip" data-theme="theme-dust" data-type="a" data-title="(A). 土砖色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                    </div>
                    <div class="demo-justify-theme">
                        <a href="#" class="demo-theme demo-a-mint add-tooltip" data-theme="theme-mint" data-type="a" data-title="(A). 薄荷绿">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                        <a href="#" class="demo-theme demo-a-yellow add-tooltip" data-theme="theme-yellow" data-type="a" data-title="(A). 黄色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                        <a href="#" class="demo-theme demo-a-well-red add-tooltip" data-theme="theme-well-red" data-type="a" data-title="(A). 墙红色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                    </div>
                    <div class="demo-justify-theme">
                        <a href="#" class="demo-theme demo-a-coffee add-tooltip" data-theme="theme-coffee" data-type="a" data-title="(A). 咖啡色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                        <a href="#" class="demo-theme demo-a-prickly-pear add-tooltip" data-theme="theme-prickly-pear" data-type="a" data-title="(A). 霸王色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                        <a href="#" class="demo-theme demo-a-dark add-tooltip" data-theme="theme-dark" data-type="a" data-title="(A). 黑色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                    </div>
                </div>
                <div class="col-md-4 pad-ver">
                    <div class="demo-justify-theme">
                        <a href="#" class="demo-theme demo-b-light add-tooltip" data-theme="theme-light" data-type="b" data-title="(B). 浅色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                        <a href="#" class="demo-theme demo-b-navy add-tooltip" data-theme="theme-navy" data-type="b" data-title="(B). 藏青色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                        <a href="#" class="demo-theme demo-b-ocean add-tooltip" data-theme="theme-ocean" data-type="b" data-title="(B). 深海蓝">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                    </div>
                    <div class="demo-justify-theme">
                        <a href="#" class="demo-theme demo-b-lime add-tooltip" data-theme="theme-lime" data-type="b" data-title="(B). 绿黄色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                        <a href="#" class="demo-theme demo-b-purple add-tooltip" data-theme="theme-purple" data-type="b" data-title="(B). 紫色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                        <a href="#" class="demo-theme demo-b-dust add-tooltip" data-theme="theme-dust" data-type="b" data-title="(B). 土砖色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                    </div>
                    <div class="demo-justify-theme">
                        <a href="#" class="demo-theme demo-b-mint add-tooltip" data-theme="theme-mint" data-type="b" data-title="(B). 薄荷绿">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                        <a href="#" class="demo-theme demo-b-yellow add-tooltip" data-theme="theme-yellow" data-type="b" data-title="(B). 黄色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                        <a href="#" class="demo-theme demo-b-well-red add-tooltip" data-theme="theme-well-red" data-type="b" data-title="(B). 墙红色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                    </div>
                    <div class="demo-justify-theme">
                        <a href="#" class="demo-theme demo-b-coffee add-tooltip" data-theme="theme-coffee" data-type="b" data-title="(B). 咖啡色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                        <a href="#" class="demo-theme demo-b-prickly-pear add-tooltip" data-theme="theme-prickly-pear" data-type="b" data-title="(B). 霸王色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                        <a href="#" class="demo-theme demo-b-dark add-tooltip" data-theme="theme-dark" data-type="b" data-title="(B). 黑色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                    </div>
                </div>
                <div class="col-md-4 pad-ver">
                    <div class="demo-justify-theme">
                        <a href="#" class="demo-theme demo-c-light add-tooltip" data-theme="theme-light" data-type="c" data-title="(C). 浅色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                        <a href="#" class="demo-theme demo-c-navy add-tooltip" data-theme="theme-navy" data-type="c" data-title="(C). 藏青色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                        <a href="#" class="demo-theme demo-c-ocean add-tooltip" data-theme="theme-ocean" data-type="c" data-title="(C). 深海蓝">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                    </div>
                    <div class="demo-justify-theme">
                        <a href="#" class="demo-theme demo-c-lime add-tooltip" data-theme="theme-lime" data-type="c" data-title="(C). 绿黄色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                        <a href="#" class="demo-theme demo-c-purple add-tooltip" data-theme="theme-purple" data-type="c" data-title="(C). 紫色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                        <a href="#" class="demo-theme demo-c-dust add-tooltip" data-theme="theme-dust" data-type="c" data-title="(C). 砖红色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                    </div>
                    <div class="demo-justify-theme">
                        <a href="#" class="demo-theme demo-c-mint add-tooltip" data-theme="theme-mint" data-type="c" data-title="(C). 薄荷绿">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                        <a href="#" class="demo-theme demo-c-yellow add-tooltip" data-theme="theme-yellow" data-type="c" data-title="(C). 黄色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                        <a href="#" class="demo-theme demo-c-well-red add-tooltip" data-theme="theme-well-red" data-type="c" data-title="(C). 墙红色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                    </div>
                    <div class="demo-justify-theme">
                        <a href="#" class="demo-theme demo-c-coffee add-tooltip" data-theme="theme-coffee" data-type="c" data-title="(C). 咖啡色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                        <a href="#" class="demo-theme demo-c-prickly-pear add-tooltip" data-theme="theme-prickly-pear" data-type="c" data-title="(C). 霸王色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                        <a href="#" class="demo-theme demo-c-dark add-tooltip" data-theme="theme-dark" data-type="c" data-title="(C). 黑色">
                            <div class="demo-theme-brand"></div>
                            <div class="demo-theme-head"></div>
                            <div class="demo-theme-nav"></div>
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="col-lg-12">
        <div class="panel">
            <div class="panel-heading">
                <h3 class="panel-title">网站信息</h3>
            </div>
            <form class="form-horizontal" id="web-forms" method="post" action="{:url('admin/web/save_webmsg')}" enctype="multipart/form-data">
                <div class="panel-body">
                    <div class="form-group">
                        <label class="col-sm-1 control-label" for="web-name">网站名称</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control input-sm" name="web[name]" id="web-name" value="{$settings.web_name}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="web-logo" class="col-sm-1 control-label">网站logo</label>
                        <div class="col-sm-6">
                            <a class="file">
                                <img id="web-logo-show" class="img-lg" src="__IMG__/profile-photos/1.png">
                                <input type="file" class="form-control" name="logo" id="web-logo">
                            </a>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="web-icpid" class="col-sm-1 control-label">网站备案号</label>
                        <div class="col-sm-6">
                           <input type="text" class="form-control input-sm" id="web-icpid" name="web[icpid]" value="{$settings.web_icpid}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-1 control-label" form="web-intro">网站介绍</label>
                        <div class="col-sm-6">
                            <textarea id="web-intro" name="web[intro]" rows="4" class="form-control">{$settings.web_intro}</textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-1 control-label">底部信息</label>
                        <div class="col-sm-9">
                            <div id="admin-summernote">
                                © 2016 Your Company
                            </div>
                        </div>
                    </div>
                </div>
                <div class="panel-footer">
                    <div class="row">
                        <div class="col-sm-9 col-sm-offset-3">
                            <button class="btn btn-mint" form="web-forms" type="button">保存</button>
                            <!-- <button class="btn btn-warning" form="web-forms" type="reset">重置</button> -->
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
   
</div>
<script type="text/javascript">
    var themeBtn = $('.demo-theme'),
    changeTheme = function (themeName, type) {
        var themeCSS = $('#theme'),
            fileext = '.min.css',
            filename = '__CSS__/themes/type-' + type + '/' + themeName + fileext,
            webtheme =  'type-' + type + '/' + themeName + fileext;
            $.ajax({
                url:"{:url('admin/web/save_theme')}",
                type:"post",
                data:{"webtheme":webtheme},
                dataType:"json",
                success:function(result){
                    if(result.status == 'success'){
                        $.niftyNoty({
                            type: 'success',
                            icon : 'pli-exclamation icon-2x',
                            message : result.msg,
                            container : 'floating',
                            timer : 1500,
                        });
                    }else{
                        $.niftyNoty({
                            type: 'warning',
                            icon : 'pli-exclamation icon-2x',
                            message : result.msg,
                            container : 'floating',
                            timer : 1500,
                        });
                    }
                },
                error:function(){
                    $.niftyNoty({
                        type: 'danger',
                        icon : 'pli-exclamation icon-2x',
                        message : '网络连接失败',
                        container : 'floating',
                        timer : 1500,
                    });
                }
            });
        if (themeCSS.length) {
            themeCSS.prop('href', filename);
        } else {
            themeCSS = '<link id="theme" href="' + filename + '" rel="stylesheet">';
            $('head').append(themeCSS);
        }
    };

    $('#demo-theme').on('click', '.demo-theme', function (e) {
        e.preventDefault();
        var el = $(this);
        if (el.hasClass('disabled')) {
            return false;
        }
        $('.demo-theme').removeClass('theme-a-active');
        el.addClass('theme-a-active');
        changeTheme(el.attr('data-theme'), el.attr('data-type'));
        themeBtn.removeClass('disabled');
        el.addClass('disabled');
        return false;
    });
    $('button[form="web-forms"]').on('click', function (e) {
        $('#web-forms').submit();
    });
    show_upload_img('web-logo-show');
    function show_upload_img(img_show_id){
        $("input[type=file]").change(function () {
            var $file = $(this);
            var fileObj = $file[0];
            var windowURL = window.URL || window.webkitURL;
            var dataURL;
            var $img = $('#'+img_show_id);
            if(fileObj && fileObj.files && fileObj.files[0]){
                dataURL = windowURL.createObjectURL(fileObj.files[0]);
                $img.attr('src',dataURL);
            }else{
                dataURL = $file.val();
                var imgObj = document.getElementById(img_show_id);
                imgObj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale)";
                imgObj.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = dataURL;

            }
        });
    }
    
</script>
<script type="text/javascript">
$(document).ready(function() {
    $('#web-summernote,#admin-summernote').summernote({
        height : '150px',
        lang   : 'zh-CN',
        fontSize : '14px'
    });
})

</script>